<?php
/**
 * 物件お問い合わせ入力(送信)<br />
 *
 * @package apamanshop
 * @author　
 * @copyright　
 */
class Inquiry_Model_Apibukken extends Inquiry_Model_Apibase
{

	/**
	 * W03BUKKEN_ACCESS_LOG 情報挿入
	 *
	 * @param array $params パラメータ
	 *		strToiawaseCd	管理物件問合せ番号CD
	 *		strKaishaCd		管理会社CD
	 *		strPrefCd		都道府県CD
	 *		strTenpoCd		店舗CD
	 *		intKoumokuFlg	項目ﾌﾗｸﾞ(1:ﾀﾞｳﾝﾛｰﾄﾞ 2:公開 3:ﾍﾟｰｼﾞﾋﾞｭｰ 4:ﾒｰﾙ)
	 *		intSiteFlg		掲載ｻｲﾄﾌﾗｸﾞ(1:HP 2:i 3:j 4:ez 5:ｷｬﾝﾊﾟｽ 6:ﾀﾞﾌﾞﾙｾﾞﾛ 7:PDA)
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsKanriBkknLog($params, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO WEBLOG1_USER.W03BUKKEN_ACCESS_LOG ( ";
		$sql .= "  W03_KOUKOKU_KAISHA_TOIAWASE_CD, ";
		$sql .= "  W03_KOUKOKU_KAISHA_CD, ";
		$sql .= "  W03_TODOUFUKEN_CD, ";
		$sql .= "  W03_TENPO_CD, ";
		$sql .= "  W03_KOUMOKU_FLAG, ";
		$sql .= "  W03_SITE_FLAG, ";
		$sql .= "  W03_DATE ";
		$sql .= ") VALUES ( ";
		$sql .= "  :strToiawaseCd, ";
		$sql .= "  :strKaishaCd, ";
		$sql .= "  :strPrefCd, ";
		$sql .= "  :strTenpoCd,";
		$sql .= "  :intKoumokuFlg,";
		$sql .= "  :intSiteFlg,";
		$sql .= "  SYSDATE";
		$sql .= ")";

		$db_params['strToiawaseCd'] = $params['strToiawaseCd'];
		$db_params['strKaishaCd'] = $params['strKaishaCd'];
		$db_params['strPrefCd'] = $params['strPrefCd'];
		$db_params['strTenpoCd'] = $params['strTenpoCd'];
		$db_params['intKoumokuFlg'] = $params['intKoumokuFlg'];
		$db_params['intSiteFlg'] = $params['intSiteFlg'];

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W03BUKKEN_ACCESS_LOG");
	}

	/**
	 * W21PAGE_VIEW_LOG 情報挿入
	 *
	 * @param array $params パラメータ
	 *		strTenpoCd	店舗CD
	 *		intKbn		表示ﾍﾟｰｼﾞ区分( 0:物件詳細, 1:店舗詳細, 2:問合せﾒｰﾙ)
	 *		intGFlg		表示ﾍﾟｰｼﾞｼﾞｬﾝﾙ区分（0:HP, 1:i-mode, 2:j-sky, 3:ez-web, 4:infogate)
	 *		strHeyaCd	自社管理部屋CD
	 *		intCount	カウント値
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsRegPageViewLog($params, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO W21PAGE_VIEW_LOG (";
		$sql .= "  W21_TENPO_CD,";
		$sql .= "  W21_DATE,";
		$sql .= "  W21_KENSAKU_FLAG,";
		$sql .= "  W21_GENRU_FLAG,";
		$sql .= "  W21_ORIGINAL_HEYA_CD,";
		$sql .= "  W21_COUNT";
		$sql .= ") VALUES (";
		$sql .= "  :strTenpoCd,";
		$sql .= "  SYSDATE,";
		$sql .= "  :intKbn,";
		$sql .= "  :intGFlg,";
		$sql .= "  :strHeyaCd,";
		$sql .= "  :intCount";
		$sql .= ")";

		$db_params['strTenpoCd'] = $params['strTenpoCd'];
		$db_params['intKbn'] = $params['intKbn'];
		$db_params['intGFlg'] = $params['intGFlg'];
		$db_params['strHeyaCd'] = $params['strHeyaCd'];
		$db_params['intCount'] = $params['intCount'];

		return $this->dbExecQuery($sql, $db_params, $db, "W21PAGE_VIEW_LOG");
	}

	/**
	 * AOS店舗チェック1
	 * RENKEI_TENPO_WORKテーブルの確認を行う
	 *
	 * @param string $shopCd 店舗コード
	 *
	 * @return 取得したデータ
	 */
	public function JdgAosShopChk1($shopCd)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "NVL(COUNT(*),0) AS CNT ";
		$sql .= "FROM RENKEI_TENPO_WORK ";
		$sql .= "WHERE TENPO_CD = :shopCd ";
		$sql .= "AND TENPO_CD <> '00000002' ";
		$sql .= "AND IKOU_FLAG = 1 ";
		$sql .= "AND TO_CHAR(IKOU_DATE, 'YYYY/MM/DD') <= TO_CHAR(SYSDATE, 'YYYY/MM/DD') ";

		$db_params['shopCd'] = $shopCd;

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * AOS店舗チェック2
	 * M05TENPO_INFOテーブルの確認を行う
	 *
	 * @param string $shopCd 店舗コード
	 *
	 * @return 取得したデータ
	 */
	public function JdgAosShopChk2($shopCd)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "NVL(M05_SHINOPE_START_DATE,'') AS M05_SHINOPE_START_DATE ";
		$sql .= "FROM M05TENPO_INFO ";
		$sql .= "WHERE M05_TENPO_CD = :shopCd ";

		$db_params['shopCd'] = $shopCd;

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * こだわり条件仕様頻度カウント検索
	 *
	 * @param string $areaCd エリアコード
	 * @param string $kodawariIds こだわりID(複数の場合は,区切り)
	 * @param connection $db DBコネクション
	 *
	 * @return 検索結果
	 */
	public function GetKodawarCnt($areaCd, $kodawariIds, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT W75_KODAWARI_ID";
		$sql .= "  FROM W75KODAWARI_COUNT ";
		$sql .= " WHERE ";
		$sql .= "     W75_AREA_CD = '" . $areaCd . "' ";
		$sql .= " AND ";

		if (!Apm_Otheritems::IsNullOrEmpty($kodawariIds))
		{
			$sql .= "W75_KODAWARI_ID IN (" . $kodawariIds . ") ";
		}
		else
		{
			$sql .= "W75_KODAWARI_ID = 0 ";
		}

		return $this->dbGetList($sql, $db_params);
	}

	/**
	 * こだわり条件仕様頻度カウント登録
	 *
	 * @param string $areaCd エリアコード
	 * @param string $kodawariId こだわりID
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsKodawarCnt($areaCd, $kodawariId, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO W75KODAWARI_COUNT (";
		$sql .= "    W75_AREA_CD";
		$sql .= "   ,W75_KODAWARI_ID";
		$sql .= "   ,W75_KODAWARI_CNT";
		$sql .= ") VALUES (";
		$sql .= "    :AreaCd";
		$sql .= "   ,:KodawariId";
		$sql .= "   ,1";
		$sql .= ")";

		$db_params['AreaCd'] = $areaCd;
		$db_params['KodawariId'] = $kodawariId;

		return $this->dbExecQuery($sql, $db_params, $db, "W75KODAWARI_COUNT");
	}

	/**
	 * こだわり条件仕様頻度カウント更新
	 *
	 * @param string $areaCd エリアコード
	 * @param string $kodawariIds こだわりID(複数の場合は,区切り)
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function UpdKodawarCnt($areaCd, $kodawariIds, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "UPDATE W75KODAWARI_COUNT ";
		$sql .= "Set W75_KODAWARI_CNT = W75_KODAWARI_CNT + 1 ";
		$sql .= "WHERE ";
		$sql .= "W75_AREA_CD = '" . $areaCd . "' ";
		$sql .= "AND ";

		if (!Apm_Otheritems::IsNullOrEmpty($kodawariIds))
		{
			$sql .= "";
			$sql .= "W75_KODAWARI_ID IN (" . $kodawariIds . ") ";
		}
		else
		{
			return 0;
		}

		return $this->dbExecQuery($sql, $db_params, $db, "W75KODAWARI_COUNT");
	}

	/**
	 * 問合せ物件一覧取得
	 *
	 * @param string $bukkenIds 物件ID(複数の場合は,区切り)
	 *
	 * @return 問合せ物件一覧
	 */
	public function GetInqBukkenList($bukkenIds)
	{
		$sql = "";
		$db_params = array();

		$bukkenIdList;
		$bukkenIdQry;

		//========================================================
		//= 変数初期化

		$bukkenIdQry = "";
		$bukkenIdList = split(",", str_replace(" ", "", $bukkenIds));

		//========================================================
		//= ｸｴﾘ用文字列の作成

		//対象部屋ﾃﾞｰﾀ一覧の取得
		foreach ($bukkenIdList as $bukkenId)
		{
			if (!Apm_Otheritems::IsNullOrEmpty($bukkenIdQry))
			{
				$bukkenIdQry .= " OR ";
			}
			$bukkenIdQry .= "T03_HEYA_CD = " . $bukkenId . " ";
		}

		//========================================================
		//= ｸｴﾘ用作成

		$sql .= "SELECT ";
		$sql .= "  T03_ORIGINAL_TATEMONO_CD01, ";
		$sql .= "  T03_ORIGINAL_HEYA_CD01, ";
		$sql .= "  T03_TATEMONO_CD, ";
		$sql .= "  T03_HEYA_BANGOU, ";
		$sql .= "  T03_JYUUSHO_TEXT, ";
		$sql .= "  T03_TATEMONO_NAME, ";
		$sql .= "  T03_HEYA_CD, ";
		$sql .= "  T03_TODOUFUKEN_CD, ";
		$sql .= "  T03_TENPO_CD, T03_TENPO_NAME, ";
		$sql .= "  T03_ENSEN_NAME, T03_EKI_NAME, ";
		$sql .= "  T03_MADORI, ";
		$sql .= "  T03_YACHIN, T03_YACHIN_TAX, ";
		$sql .= "  T03_KANRIHI, T03_KANRIHI_TAX, ";
		$sql .= "  T03_REIKIN, T03_REIKIN_TSUKISUU, ";
		$sql .= "  T03_SHIKIKIN, T03_SHIKIKIN_TSUKISUU,  ";
		$sql .= "  T03_hoshoukin, T03_hoshoukin_tsukisuu, ";
		$sql .= "  T03_shoukyakukin, t03_shoukyakukin_tsukisuu, ";
		$sql .= "  T03_BUS_GAISHA, T03_BUS_STOP, T03_BUS_JYOUSHA, ";
		$sql .= "  T03_TOHO01,T03_SENYUU_MENSEKI, ";
		$sql .= "  T03_TATEMONO_KOUZOU, ";
		$sql .= "  T03_KANSEINEN, T03_KANSEITSUKI, ";
		$sql .= "  T03_GAIKAN_GAZOU01, T03_MADORIZU,";
		$sql .= "  T03_GAIKAN_GAZOU02, ";
		$sql .= "  T03_GAIKAN_GAZOU03, ";
		$sql .= "  T03_GAIKAN_GAZOU04, ";
		$sql .= "  T03_GAIKAN_GAZOU05, ";
		$sql .= "  T03_HAICHIZU, ";
		$sql .= "  T03_SHUHEN_GAZOU01, ";
		$sql .= "  T03_SHUHEN_GAZOU02, ";
		$sql .= "  T03_NAISOU_GAZOU01, ";
		$sql .= "  T03_NAISOU_GAZOU02, ";
		$sql .= "  T03_NAISOU_GAZOU03, ";
		$sql .= "  T03_NAISOU_GAZOU04, ";
		$sql .= "  T03_NAISOU_GAZOU05, ";
		$sql .= "  T03_NAISOU_GAZOU06, ";
		$sql .= "  T03_NAISOU_GAZOU07, ";
		$sql .= "  T03_NAISOU_GAZOU08, ";
		$sql .= "  T03_NAISOU_GAZOU09, ";
		$sql .= "  T03_NAISOU_GAZOU10, ";
		$sql .= "  T03_PANORAMA_GAZOU01, ";
		$sql .= "  T03_PANORAMA_GAZOU02, ";
		$sql .= "  T03_MADORIZU_3D, ";
		$sql .= "  T03_PR01, ";
		$sql .= "  T03_PR02, ";
		$sql .= "  M05_TENPO_CD, ";
		$sql .= "  M05_TENPO_NAME, ";
		$sql .= "  M05_TENPO_TEL01, ";
		$sql .= "  M05_TENPO_MAIL, ";
		$sql .= "  T03_KOUKOKU_KAISHA_CD, ";
		$sql .= "  T03_KOUKOKU_TOIAWASE_NO, ";
		$sql .= "  T03_KASHIDASHI_KUBUN, ";
		$sql .= "  T03_CAMPAIGN_FLAG, ";
		$sql .= "  T03_CAMPAIGN2_FLAG, ";
		$sql .= "  T03_CAMPAIGN3_FLAG, ";
		$sql .= "  T03_CAMPAIGN4_FLAG, ";
		$sql .= "  T03_CAMPAIGN5_FLAG, ";
		$sql .= "  T03_CAMPAIGN6_FLAG, ";
		$sql .= "  T03_CAMPAIGN7_FLAG, ";
		$sql .= "  T03_CAMPAIGN8_FLAG, ";
		$sql .= "  T03_CAMPAIGN9_FLAG, ";
		$sql .= "  T03_CAMPAIGN10_FLAG, ";
		$sql .= "  T03_FREERENT_FLAG, ";
		$sql .= "  T03_HEYAWARI_FLAG, ";
		$sql .= "  M01_TODOUFUKEN, ";
		$sql .= "  M01_SHIKUCHOUSON, ";
		for ($call_no=1; $call_no<=Apm_Config_Shop::CALLNOTE_NO_MAX; $call_no++) {
			$sql .= " M93_CONNECTION_NO".$call_no.",";
			$sql .= " M93_CONTROL_FLAG".$call_no.",";
		}
		$sql .= "  M93_USE_KBN, ";
		$sql .= "  M93_START_DATE, ";
		$sql .= "  M93_DEL_DATE ";
		$sql .= "FROM T03WEB_HEYA ,M05TENPO_INFO, M01JYUUSHO, M93CALLNOTE ";		// 2013/08 WEBCALLING→CALLNOTE 切替
		$sql .= "WHERE ( " . $bukkenIdQry . " ) ";
		$sql .= "AND M05_TENPO_CD(+) = T03_TENPO_CD ";
		$sql .= "AND M01_TODOUFUKEN_CD(+) = T03_TODOUFUKEN_CD ";
		$sql .= "AND M01_SHIKUCHOUSON_CD(+) = T03_SHIKUCHOUSON_CD ";
		$sql .= "AND M01_CHOUMEI_CD(+) = T03_CHOUMEI_CD ";
		$sql .= "AND M01_CHOUMOKU_CD(+) = T03_CHOUMOKU_CD ";
		$sql .= "AND M93_TENPO_CD(+) = T03_TENPO_CD ";
		$sql .= "ORDER BY T03_TENPO_CD ";

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * 問合せﾕｰｻﾞ情報格納
	 *
	 * @param array $params パラメータ
	 *		strToiawaseId		問合せID
	 *		intLogGenruKbn		表示ﾍﾟｰｼﾞｼﾞｬﾝﾙ区分
	 *		strNameSei			名前(姓)
	 *		strNameMei			名前(名)
	 *		strCntctWayCd		希望連絡手段
	 *		strMail				メールアドレス
	 *		strTel				電話番号
	 *		strFax				FAX番号
	 *		strNeedTimeKbn		希望連絡時間区分
	 *		strComment			問い合わせ内容(自由記入文章)
	 *		strMailMgznFlg		メールマガジンフラグ
	 *		strSrhKbn			検索区分
	 *		strUserActKbn		ﾕｰｻﾞ行動区分
	 *		strOemCd			OEMコード
	 *		strInquiry			問い合わせ内容
	 *		strCampaign1		キャンペーン1
	 *		strCampaign2		キャンペーン2
	 *		strCampaign3		キャンペーン3
	 *		strCampaign4		キャンペーン4
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsInqUserLog($params, $db)
	{
		$sql = "";
		$db_params = array();

		//========================================================
		//= ｸｴﾘ作成
		//TODO:変数名していで後でバインドする場合はクエ利用の変換は明示的にする必要はなくなるとおもう。

		$sql .= "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$sql .= "W25_TOIAWASE_ID, ";
		$sql .= "W25_KENSAKU_FLAG, ";
		$sql .= "W25_GENRU_FLAG, ";
		$sql .= "W25_DATE, ";
		$sql .= "W25_NAME, ";
		$sql .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$sql .= "W25_MAIL, ";
		$sql .= "W25_TEL, ";
		$sql .= "W25_FAX, ";
		$sql .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$sql .= "W25_TOIAWASE_NAIYOU_SHUBETSU, ";
		$sql .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
		$sql .= "W25_MAIL_MAGAZINE_NEED_FLAG, ";
		$sql .= "W25_SEARCH_KUBUN, ";
		$sql .= "W25_USER_ACT_KUBUN, ";
		$sql .= "W25_OEM_CD, ";
		$sql .= "W25_DELETE_FLAG, ";
		$sql .= "W25_TOIAWASE_NAIYOU, ";
		$sql .= "W25_CAMPAIGN, ";
		$sql .= "W25_CAMPAIGN2, ";
		$sql .= "W25_CAMPAIGN3, ";
		$sql .= "W25_CAMPAIGN4, ";
		$sql .= "W25_ROOT_KUBUN,";
		$sql .= "W25_ROOT_ALL,";
		$sql .= "W25_NAME_KANA )";// 20141211 Add
		$sql .= "VALUES ";
		$sql .= "( ";
		$sql .=  $params["strToiawaseId"] . ",";
		$sql .=  "0, ";
		$sql .=  $params["intLogGenruKbn"] . ", ";
		$sql .= "SYSDATE, ";

		// 文字コードがUTF-8の場合、
		// ChgQryFmtではシングルクォートを除去する際にマルチバイト文字列が
		// 文字化けが発生する可能性があるため修正
// 		$sql .=  $this->ChgQryFmt(trim($params["strNameSei"] . "　" . $params["strNameMei"], "　"),"'") . ",";
		$sql .= " :Name ,";
		$sql .=  $this->ChgQryFmt($params["strCntctWayCd"],"'") . ",";
		$sql .=  $this->ChgQryFmt($params["strMail"],"'") . ",";
		$sql .=  $this->ChgQryFmt($params["strTel"],"'") . ",";
		$sql .=  $this->ChgQryFmt($params["strFax"],"'") . ",";
		$sql .=  $this->ChgQryFmt($params["strNeedTimeKbn"],"") . ",";
		$sql .=  $this->ChgQryFmt("","'") . ",";
// 		$sql .=  $this->ChgQryFmt($params["strComment"],"'") . ",";
		$sql .= " :strComment ,";
		$sql .=  $this->ChgQryFmt($params["strMailMgznFlg"],"") . ",";
		$sql .=  $this->ChgQryFmt($params["strSrhKbn"],"'")  . ",";
		$sql .=  $this->ChgQryFmt($params["strUserActKbn"],"") . ",";
		$sql .=  $this->ChgQryFmt($params["strOemCd"],"'")  . ",";
		$sql .= "0,";
		$sql .=  $this->ChgQryFmt($params["strInquiry"],"'") . ",";
		$sql .=  $params["strCampaign1"] . ",";
		$sql .=  $params["strCampaign2"] . ",";
		$sql .=  $params["strCampaign3"] . ",";
		$sql .=  $params["strCampaign4"] . ",";
		$sql .= " :LpCampaignCd ,";
		$sql .= " :LpRootCd ,";
// 		$sql .=  $this->ChgQryFmt(trim($params["strNameSeiKana"] . "　" . $params["strNameMeiKana"], "　"),"'") . ")";// 20141211 Add
		$sql .= " :NameKana ";
		$sql .= ")";

		$db_params['Name']         = trim($params["strNameSei"] . "　" . $params["strNameMei"]);
		$db_params['NameKana']     = trim($params["strNameSeiKana"] . "　" . $params["strNameMeiKana"]);
		$db_params['strComment']   = $params["strComment"];

		$db_params['LpCampaignCd'] = $params["LpCampaignCd"];
		$db_params['LpRootCd']     = $params["LpRootCd"];
		//========================================================
		//= ｸｴﾘ発行
		return $this->dbExecQuery($sql, $db_params, $db, "W25TOIAWASE_USER_LOG");
	}

	/**
	 * 問い合わせ物件情報登録
	 *
	 * @param string $strToiawaseId 問合せID
	 * @param array $bukkenInfo 物件情報(テーブルから取得した物そのまま)
	 * @param string $strOtakaraFlg お宝フラグ
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsInqBukkenLog($strToiawaseId, $bukkenInfo, $strOtakaraFlg, $db)
	{
		$sql = "";
		$db_params = array();

		//画像ｾｯﾄ
		$intGazouSet;
		//キャンペーンフラグ
		$strCampaignFlg;
		//キャンペーンフラグ桁
		$strCampaignKeta;
		//訳あり区分
		$strWakeariKbn;

		//========================================================
		//= 変数初期化

		$strCampaignFlg = "0";
		$strCampaignKeta = "";
		$intGazouSet = 0;
		$strWakeariKbn = "";

		//キャンペーンフラグ桁
		//TODO:～9まではforでうまく簡略化できる。
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = "1";
		}
		else
		{
			$strCampaignKeta = "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN2_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN3_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN4_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN5_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN6_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN7_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN8_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if (strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN9_FLAG"],""), "1") == 0)
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}
		if ((strcmp($this->ChgQryFmt($bukkenInfo["T03_CAMPAIGN10_FLAG"],""), "1") == 0) || (strcmp($strOtakaraFlg, "1") == 0))
		{
			$strCampaignFlg = "1";
			$strCampaignKeta = $strCampaignKeta . "1";
		}
		else
		{
			$strCampaignKeta = $strCampaignKeta . "0";
		}

		//画像
		if (!Apm_Otheritems::IsNullOrEmpty($this->Fs_ChangeValue($bukkenInfo["T03_GAIKAN_GAZOU01"], "")))
		{
			//外観画像が設定されていた場合
			$intGazouSet = 1;
		}
		if (!Apm_Otheritems::IsNullOrEmpty($this->Fs_ChangeValue($bukkenInfo["T03_MADORIZU"], "")))
		{
			//間取図が設定されていた場合
			$intGazouSet += 2;
		}

		//わけあり区分
		if ((strpos($bukkenInfo["T03_PR01"], "①") !== false) || (strpos($bukkenInfo["T03_PR02"], "①") !== false))
		{
			$strWakeariKbn = "1";
		}
		elseif ((strpos($bukkenInfo["T03_PR01"], "②") !== false) || (strpos($bukkenInfo["T03_PR02"], "②") !== false))
		{
			$strWakeariKbn = "2";
		}
		elseif ((strpos($bukkenInfo["T03_PR01"], "③") !== false) || (strpos($bukkenInfo["T03_PR02"], "③") !== false))
		{
			$strWakeariKbn = "3";
		}
		elseif ((strpos($bukkenInfo["T03_PR01"], "④") !== false) || (strpos($bukkenInfo["T03_PR02"], "④") !== false))
		{
			$strWakeariKbn = "4";
		}
		elseif ((strpos($bukkenInfo["T03_PR01"], "⑤") !== false) || (strpos($bukkenInfo["T03_PR02"], "⑤") !== false))
		{
			$strWakeariKbn = "5";
		}
		elseif ((strpos($bukkenInfo["T03_PR01"], "⑥") !== false) || (strpos($bukkenInfo["T03_PR02"], "⑥") !== false))
		{
			$strWakeariKbn = "6";
		}

		//========================================================
		//= ｸｴﾘ作成
		//TODO:変数名していで後でバインドする場合はクエ利用の変換は明示的にする必要はなくなるとおもう。

		$sql .= "INSERT INTO W26TOIAWASE_BUKKEN( ";
		$sql .= "W26_TOIAWASE_ID, ";
		$sql .= "W26_TENPO_CD, ";
		$sql .= "W26_ORIGINAL_HEYA_CD01, ";
		$sql .= "W26_ENSEN_NAME, ";
		$sql .= "W26_EKI_NAME, ";
		$sql .= "W26_MADORI, ";
		$sql .= "W26_YACHIN, ";
		$sql .= "W26_YACHIN_TAX, ";
		$sql .= "W26_KANRIHI,";
		$sql .= "W26_KANRIHI_TAX,";
		$sql .= "W26_REIKIN, ";
		$sql .= "W26_REIKIN_TSUKISUU, ";
		$sql .= "W26_SHIKIKIN, ";
		$sql .= "W26_SHIKIKIN_TSUKISUU, ";
		$sql .= "W26_HOSHOUKIN, ";
		$sql .= "W26_HOSHOUKIN_TSUKISUU, ";
		$sql .= "W26_SHOUKYAKUKIN, ";
		$sql .= "W26_SHOUKYAKUKIN_TSUKISUU, ";
		$sql .= "W26_BUS_GAISHA, ";
		$sql .= "W26_BUS_STOP, ";
		$sql .= "W26_BUS_JYOUSHA, ";
		$sql .= "W26_TOHO01, ";
		$sql .= "W26_SENYUU_MENSEKI, ";
		$sql .= "W26_TATEMONO_KOUZOU, ";
		$sql .= "W26_KANSEINEN, ";
		$sql .= "W26_KANSEITSUKI, ";
		$sql .= "W26_GAZOU_SETTEI, ";
		$sql .= "W26_CAMPAIGN_FLAG, ";
		$sql .= "W26_CAMPAIGN_FLAG_KETA, ";
		$sql .= "W26_GAIKAN_GAZOU01_FLAG, ";
		$sql .= "W26_GAIKAN_GAZOU02_FLAG, ";
		$sql .= "W26_GAIKAN_GAZOU03_FLAG, ";
		$sql .= "W26_GAIKAN_GAZOU04_FLAG, ";
		$sql .= "W26_GAIKAN_GAZOU05_FLAG, ";
		$sql .= "W26_HAICHIZU_FLAG, ";
		$sql .= "W26_SHUHEN_GAZOU01_FLAG, ";
		$sql .= "W26_SHUHEN_GAZOU02_FLAG, ";
		$sql .= "W26_MADORIZU_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU01_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU02_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU03_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU04_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU05_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU06_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU07_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU08_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU09_FLAG, ";
		$sql .= "W26_NAISOU_GAZOU10_FLAG, ";
		$sql .= "W26_PANORAMA_GAZOU01_FLAG, ";
		$sql .= "W26_PANORAMA_GAZOU02_FLAG, ";
		$sql .= "W26_MADORIZU_3D_FLAG, ";
		$sql .= "W26_WAKEARI_KBN ) ";
		$sql .= "VALUES ( ";
		$sql .= $strToiawaseId . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_TENPO_CD"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_ORIGINAL_HEYA_CD01"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_ENSEN_NAME"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_EKI_NAME"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_MADORI"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_YACHIN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_YACHIN_TAX"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_KANRIHI"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_KANRIHI_TAX"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_REIKIN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_REIKIN_TSUKISUU"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_SHIKIKIN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_SHIKIKIN_TSUKISUU"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_HOSHOUKIN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_HOSHOUKIN_TSUKISUU"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_SHOUKYAKUKIN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_SHOUKYAKUKIN_TSUKISUU"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_BUS_GAISHA"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_BUS_GAISHA"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_BUS_JYOUSHA"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_TOHO01"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_SENYUU_MENSEKI"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_TATEMONO_KOUZOU"],"'") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_KANSEINEN"],"") . ", ";
		$sql .= $this->ChgQryFmt($bukkenInfo["T03_KANSEITSUKI"],"") . ", ";
		$sql .= $this->ChgQryFmt(strval($intGazouSet),"") . ", ";
		$sql .= "'" . $strCampaignFlg . "', ";
		$sql .= "'" . $strCampaignKeta . "', ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_GAIKAN_GAZOU01"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_GAIKAN_GAZOU02"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_GAIKAN_GAZOU03"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_GAIKAN_GAZOU04"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_GAIKAN_GAZOU05"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_HAICHIZU"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_SHUHEN_GAZOU01"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_SHUHEN_GAZOU02"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_MADORIZU"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU01"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU02"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU03"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU04"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU05"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU06"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU07"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU08"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU09"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_NAISOU_GAZOU10"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_PANORAMA_GAZOU01"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_PANORAMA_GAZOU02"]) . ", ";
		$sql .= $this->ChgQryFmtToFlg($bukkenInfo["T03_MADORIZU_3D"])  . ", ";
		$sql .= "'" . $strWakeariKbn . "'";
		$sql .= ")";

		//========================================================
		//= ｸｴﾘ発行
		return $this->dbExecQuery($sql, $db_params, $db, "W26TOIAWASE_BUKKEN");
	}

	//=====../include/cgi/Kodawari.inc=====
	//スプリットカウント取得
	//パラメータ
	//  key：キー

	public function GetSplitCount($key, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT T101.T101_COUNT FROM T101TARGET_COUNT T101 WHERE T101.T101_TARGET_KEY = :targetKey";

		$db_params['targetKey'] = $key;

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * スプリットカウント更新
	 *
	 * @param string $key キー
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function UpdSplitCount($key, $db)
	{
		$sql = "";
		$db_params = array();

		$sql .= "UPDATE T101TARGET_COUNT ";
		$sql .= "Set T101_COUNTUP_DATE = SYSDATE, T101_COUNT = T101_COUNT + 1 ";
		$sql .= "WHERE ";
		$sql .= "T101_TARGET_KEY = :targetKey ";

		$db_params['targetKey'] = $key;

		return $this->dbExecQuery($sql, $db_params, $db, "T101TARGET_COUNT");
	}

	/**
	 * 部屋別キャンペーン情報を取得する
	 * ※部屋コード、キャンペーンコードでまとめてる(お宝は除外)
	 *
	 * @param int $intHeyaCd 部屋コード
	 * @param int $isMobile モバイルフラグ
	 *
	 * @return array 部屋別キャンペーン情報
	 */
	public function GetWebHeyaCampaign($intHeyaCd, $isMobile = 0)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "   T03.T03_HEYA_CD ";
		$sql .= "  ,T03.T03_ITEM_CD";
		$sql .= "  ,HEYA.T03_PONTA_TINRYO_FLG";
		$sql .= "  ,HEYA.T03_PONTA_TINRYO_POINT";
		$sql .= "  ,HEYA.T03_PONTA_SEIYAKU_FLG";
		$sql .= "  ,HEYA.T03_PONTA_SEIYAKU_POINT";
		$sql .= "  ,HEYA.T03_TENPO_CD ";
		$sql .= "  ,HEYA.T03_ORIGINAL_HEYA_CD01 ";
		$sql .= "  ,HEYA.T03_KASHIDASHI_KUBUN ";
		$sql .= "  ,M94_CAMPAIGN_CD ";
		$sql .= "  ,M94_CAMPAIGN_NAME ";
		$sql .= "  ,M94_START_YMD ";
		$sql .= "  ,M94_END_YMD ";
		$sql .= "  ,M94_CAMPAIGN_RYAKUSHOU ";
		$sql .= "  ,M94_CAMPAIGN_SETUMEI ";
		$sql .= "  ,M94_CAMPAIGN_KBN ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI ";
		$sql .= "  ,M94_CAMPAIGN_RANK ";
		$sql .= "  ,M94_CAMPAIGN_PRIORITY_NO ";
		$sql .= "  ,M94_CAMPAIGN_URL ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU ";
		$sql .= "  ,M94_CAMPAIGN_PR_SEARCH ";
		$sql .= "  ,M94_CAMPAIGN_NAME_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_URL_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU_MOBILE ";
		$sql .= "  ,M94_TOUROKU_YMD ";
		$sql .= "  ,M94_DELETE_FLAG ";
		$sql .= "  ,M94_UPDATE_YMD ";
		$sql .= "FROM ";
		//===部屋別キャンペーン取得(お宝除外するため部屋、キャンペーンでDISTINCT)===
		//   [備考]
		//　　同種のお宝が存在する場合は最大の値を持つお宝CDを反響登録する
		//
		//		・家電キャンペーンは、複数お宝が存在する場合は一つの反響として扱い、
		//		　登録されたお宝CDは無視する
		//		・お宝CDごとに反響を取るAKBや白クマキャンペーンは、それぞれのキャンペーン
		//		  に一つのお宝CDしか選択できない。そのため、T03_HEYA_CD、T03_CAMPAIGN_CD、
		//		　でGROUPBYをかけても登録される反響は同じとなる。
		$sql .= "  ( ";
		$sql .= "    SELECT  ";
		$sql .= "       T03_HEYA_CD ";
		$sql .= "      ,T03_CAMPAIGN_CD ";
		$sql .= "      ,max(T03_OTAKARA_CD) T03_ITEM_CD";
		$sql .= "    FROM ";
		$sql .= "      ASNFC_USER.T03WEB_HEYA_CAMPAIGN ";
		$sql .= "    GROUP BY ";
		$sql .= "       T03_HEYA_CD ";
		$sql .= "      ,T03_CAMPAIGN_CD ";
		$sql .= "  ) T03 ";
		//===キャンペーンマスタ連結===
		$sql .= "  INNER JOIN ASNFC_USER.M94CAMPAIGN ";
		$sql .= "    ON (T03_CAMPAIGN_CD = M94_CAMPAIGN_CD) ";
		$sql .= "  INNER JOIN ASNFC_USER.T03WEB_HEYA HEYA ";
		$sql .= "    ON (T03.T03_HEYA_CD = HEYA.T03_HEYA_CD) ";

		//部屋コード
		$sql .= "WHERE T03.T03_HEYA_CD = :heyaCd ";
		$db_params["heyaCd"] = $intHeyaCd;

		//有効期間(開始がnullの場合は無効とする。終了がnullの場合はエンドレスとする)
		$sql .= "  AND :nowDate BETWEEN NVL(M94_START_YMD, '99999999') AND NVL(M94_END_YMD, '99999999') ";
		$db_params["nowDate"] = date("Ymd");

		//モバイル区分
		$sql .= " AND M94_MOBILE_KBN = " . $isMobile . " ";

		//===並び順===
		$sql .= "ORDER BY ";
		$sql .= "   M94_CAMPAIGN_TOKUSYU_KBN ";
		$sql .= "  ,M94_CAMPAIGN_RANK ";
		$sql .= "  ,M94_CAMPAIGN_PRIORITY_NO ";
		$sql .= "  ,NVL(M94_START_YMD, '00000000') desc ";

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * キャンペーン情報を取得する。
	 *
	 * @param string $strCampaignKbn キャンペーン区分(必須)(複数の場合はカンマ区切り)
	 * @param int $intInquiryKbn 問い合わせ区分（0=物件問い合わせ、1=物件リクエスト、2=店舗問い合わせ）
	 * @param string $strMobileKbn モバイル区分
	 * @return array キャンペーン情報
	 */
	public function GetCampaignEx($strCampaignKbn, $intInquiryKbn=null, $strMobileKbn='0')
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "   M94_CAMPAIGN_CD ";
		$sql .= "  ,M94_CAMPAIGN_NAME ";
		$sql .= "  ,M94_START_YMD ";
		$sql .= "  ,M94_END_YMD ";
		$sql .= "  ,M94_CAMPAIGN_RYAKUSHOU ";
		$sql .= "  ,M94_CAMPAIGN_SETUMEI ";
		$sql .= "  ,M94_CAMPAIGN_KBN ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI ";
		$sql .= "  ,M94_CAMPAIGN_RANK ";
		$sql .= "  ,M94_CAMPAIGN_PRIORITY_NO ";
		$sql .= "  ,M94_CAMPAIGN_URL ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU ";
		$sql .= "  ,M94_CAMPAIGN_PR_SEARCH ";
		$sql .= "  ,M94_CAMPAIGN_NAME_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_URL_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU_MOBILE ";
		$sql .= "  ,M94_WEBCALLING_TYPE ";
		$sql .= "  ,M94_WEBCALLING_PRIORITY ";
		$sql .= "  ,M94_CAMPAIGN_TOKUSYU_KBN ";
		$sql .= "  ,M94_DEFAULT_CHECK_CD ";
		$sql .= "  ,M94_BUKKEN_INQ_FLG ";
		$sql .= "  ,M94_REQUEST_INQ_FLG ";
		$sql .= "  ,M94_SHOP_INQ_FLG ";
		$sql .= "  ,DBMS_RANDOM.STRING('x',10) ACCESS_KEY ";
		$sql .= "FROM ";
		$sql .= "  ASNFC_USER.M94CAMPAIGN ";

		//===条件===
		$sql .= "WHERE M94_DELETE_FLAG = 0 ";

		//モバイル区分
		if (!Apm_Otheritems::IsNullOrEmpty($strMobileKbn))
		{
			$sql .= " AND M94_MOBILE_KBN = :mobileKbn ";
			$db_params["mobileKbn"] = $strMobileKbn;
		}

		//キャンペーン区分
		if (!Apm_Otheritems::IsNullOrEmpty($strCampaignKbn))
		{
			$sql .= " AND M94_CAMPAIGN_KBN IN (" . $strCampaignKbn . ") ";
		}

		//有効期間(開始がnullの場合は無効とする。終了がnullの場合はエンドレスとする)
		$sql .= "  AND :nowDate BETWEEN NVL(M94_START_YMD, '99999999') AND NVL(M94_END_YMD, '99999999') ";
		$db_params["nowDate"] = date("Ymd");

		//問い合わせ区分
		if (!is_null($intInquiryKbn))
		{
			switch($intInquiryKbn) {
				case 0:
					$sql .= " AND M94_BUKKEN_INQ_FLG = '1'";
					break;
				case 1:
					$sql .= " AND M94_REQUEST_INQ_FLG = '1'";
					break;
				case 2:
					$sql .= " AND M94_SHOP_INQ_FLG = '1'";
					break;
			}
		}

		//===並び順===
		$sql .= "ORDER BY ";
		$sql .= "   nvl(M94_CAMPAIGN_RANK,0) ASC ";
		$sql .= "  ,nvl(M94_CAMPAIGN_PRIORITY_NO,0) ASC ";
		$sql .= "  ,M94_START_YMD ";

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * キャンペーン情報を取得する
	 *
	 * @param int $strCampaignKbn キャンペーン区分(必須)(複数の場合はカンマ区切り)
	 * @param int $intCampaignCd キャンペーンコード
	 * @param int $isMobile モバイルフラグ
	 * @return array キャンペーン情報リスト
	 */
	public function GetCampaign($strCampaignKbn, $intCampaignCd = null, $isMobile = 0)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "   M94_CAMPAIGN_CD ";
		$sql .= "  ,M94_CAMPAIGN_NAME ";
		$sql .= "  ,M94_START_YMD ";
		$sql .= "  ,M94_END_YMD ";
		$sql .= "  ,M94_CAMPAIGN_RYAKUSHOU ";
		$sql .= "  ,M94_CAMPAIGN_SETUMEI ";
		$sql .= "  ,M94_CAMPAIGN_KBN ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI ";
		$sql .= "  ,M94_CAMPAIGN_RANK ";
		$sql .= "  ,M94_CAMPAIGN_PRIORITY_NO ";
		$sql .= "  ,M94_CAMPAIGN_URL ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU ";
		$sql .= "  ,M94_CAMPAIGN_PR_SEARCH ";
		$sql .= "  ,M94_CAMPAIGN_NAME_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_URL_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU_MOBILE ";
		$sql .= "  ,M94_TOUROKU_YMD ";
		$sql .= "  ,M94_DELETE_FLAG ";
		$sql .= "  ,M94_UPDATE_YMD ";
		$sql .= "  ,DBMS_RANDOM.STRING('x',10) ACCESS_KEY ";
		$sql .= "FROM ";
		$sql .= "  ASNFC_USER.M94CAMPAIGN ";

		//===条件===
		$sql .= "WHERE M94_DELETE_FLAG = 0 ";
		//モバイル区分は固定でやってます⇒モバイル反響と併用のため、動的に変更
		$sql .= " AND M94_MOBILE_KBN = " . $isMobile . " ";

		//キャンペーン区分
		if (!Apm_Otheritems::IsNullOrEmpty($strCampaignKbn))
		{
			$sql .= " AND M94_CAMPAIGN_KBN IN (" . $strCampaignKbn . ") ";

		}

		//有効期間(開始がnullの場合は無効とする。終了がnullの場合はエンドレスとする)
		$sql .= "  AND :nowDate BETWEEN NVL(M94_START_YMD, '99999999') AND NVL(M94_END_YMD, '99999999') ";
		$db_params["nowDate"] = date("Ymd");

		//キャンペーンコード
		if (!is_null($intCampaignCd))
		{
			$sql .= " AND M94_CAMPAIGN_CD = :campaignCd ";
			$db_params["campaignCd"] = $intCampaignCd;
		}

		//===並び順===
		$sql .= "ORDER BY ";
		$sql .= "   nvl(M94_CAMPAIGN_RANK,0) ASC ";
		$sql .= "  ,nvl(M94_CAMPAIGN_PRIORITY_NO,0) ASC ";
		$sql .= "  ,M94_START_YMD ";

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * キャンペーン情報リストを取得する(ss-sakakibara)
	 *
	 * @param int $strCampaignKbn キャンペーン区分(必須)(複数の場合はカンマ区切り)
	 * @param int $intCampaignCd キャンペーンコード
	 * @param int $isMobile モバイルフラグ
	 * @return array キャンペーン情報リスト
	 */
	public function GetCampaignList($strCampaignKbn, $intCampaignCdList = null, $isMobile = 0)
	{
		$sql = "";
		$db_params = array();

		//駅CDをカンマ区切りにする
		$campaignCd='';
		$index = 0;
		foreach ($intCampaignCdList as $value)
		{
			$campaignCd .= ' :campaignCd_'.$index.', ';
			$db_params['campaignCd_'.$index] = $value;
			$index++;
		}
		$campaignCd = substr($campaignCd,0,strlen($campaignCd)-2);

		$sql .= "SELECT ";
		$sql .= "   M94_CAMPAIGN_CD ";
		$sql .= "  ,M94_CAMPAIGN_NAME ";
		$sql .= "  ,M94_START_YMD ";
		$sql .= "  ,M94_END_YMD ";
		$sql .= "  ,M94_CAMPAIGN_RYAKUSHOU ";
		$sql .= "  ,M94_CAMPAIGN_SETUMEI ";
		$sql .= "  ,M94_CAMPAIGN_KBN ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI ";
		$sql .= "  ,M94_CAMPAIGN_RANK ";
		$sql .= "  ,M94_CAMPAIGN_PRIORITY_NO ";
		$sql .= "  ,M94_CAMPAIGN_URL ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU ";
		$sql .= "  ,M94_CAMPAIGN_PR_SEARCH ";
		$sql .= "  ,M94_CAMPAIGN_NAME_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_LIST_FLAG_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_HYOUZI_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_URL_MOBILE ";
		$sql .= "  ,M94_CAMPAIGN_GAZOU_MOBILE ";
		$sql .= "  ,M94_TOUROKU_YMD ";
		$sql .= "  ,M94_DELETE_FLAG ";
		$sql .= "  ,M94_UPDATE_YMD ";
		$sql .= "  ,DBMS_RANDOM.STRING('x',10) ACCESS_KEY ";
		$sql .= "FROM ";
		$sql .= "  ASNFC_USER.M94CAMPAIGN ";

		//===条件===
		$sql .= "WHERE M94_DELETE_FLAG = 0 ";
		//モバイル区分は固定でやってます⇒モバイル反響と併用のため、動的に変更
		$sql .= " AND M94_MOBILE_KBN = " . $isMobile . " ";

		//キャンペーン区分
		if (!Apm_Otheritems::IsNullOrEmpty($strCampaignKbn))
		{
			$sql .= " AND M94_CAMPAIGN_KBN IN (" . $strCampaignKbn . ") ";

		}

		//有効期間(開始がnullの場合は無効とする。終了がnullの場合はエンドレスとする)
		$sql .= "  AND :nowDate BETWEEN NVL(M94_START_YMD, '99999999') AND NVL(M94_END_YMD, '99999999') ";
		$db_params["nowDate"] = date("Ymd");

		//キャンペーンコード
		if (is_array($intCampaignCdList) && count($intCampaignCdList) > 0)
		{
			$sql .= " AND M94_CAMPAIGN_CD IN (".$campaignCd.') ';
		}

		//===並び順===
		$sql .= "ORDER BY ";
		$sql .= "   nvl(M94_CAMPAIGN_RANK,0) ASC ";
		$sql .= "  ,nvl(M94_CAMPAIGN_PRIORITY_NO,0) ASC ";
		$sql .= "  ,M94_START_YMD ";

		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * お宝情報を取得する
	 *
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intTakaraCd お宝コード
	 * @return array お宝情報リスト
	 */
	public function GetCampaignTakara($intCampaignCd, $intTakaraCd = null)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "   M94_CAMPAIGN_CD ";
		$sql .= "  ,M94_OTAKARA_CD ";
		$sql .= "  ,M94_OTAKARA_WORD ";
		$sql .= "  ,M94_OTAKARA_NAME ";
		$sql .= "  ,M94_TOUROKU_YMD ";
		$sql .= "  ,M94_DELETE_FLAG ";
		$sql .= "  ,M94_UPDATE_YMD ";
		$sql .= "FROM ";
		$sql .= "  ASNFC_USER.M94CAMPAIGN_OTAKARA_KEYWORD ";

		//===条件===
		$sql .= "WHERE M94_DELETE_FLAG = 0 ";

		//キャンペーンコード
		$sql .= "  AND M94_CAMPAIGN_CD = :campaignCd ";
		$db_params["campaignCd"] = $intCampaignCd;
		//お宝コード
		if (!is_null($intCampaignCd))
		{
			$sql .= "  AND M94_OTAKARA_CD = :otakaraCd ";
		$db_params["otakaraCd"] = $intTakaraCd;
		}

		//===並び順===
		$sql .= "ORDER BY ";
		$sql .= "   M94_OTAKARA_CD ASC ";


		$result = $this->dbGetList($sql, $db_params);
		return $result;
	}

	/**
	 * キャンペーン反響情報を取得する
	 *
	 * @paarm connection $db DBコネクション
	 * @param int $intCampaignKbn キャンペーン区分(必須)
	 * @param string $strToiawaseYmd 問合せ年月日(必須)
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intDeviceKbn デバイス区分(必須)
	 * @param int $intToiawaseKbn 問い合わせ区分(必須)
	 * @param int $intKensakuKbn 反響区分 0:物件問合せﾒｰﾙ 1:ﾘｸｴｽﾄﾒｰﾙ 2:店舗問合せﾒｰﾙ
	 * @return array キャンペーン情報リスト
	 */
	public function GetLettersCampaign($db, $intCampaignKbn, $strToiawaseYmd, $intCampaignCd, $intDeviceKbn, $intToiawaseKbn, $intKensakuKbn = 0)
	{
		$sql = "";
		$db_params = array();

		$sql .= "SELECT ";
		$sql .= "   W75_CAMPAIGN_KBN ";
		$sql .= "  ,W75_TOIAWASE_YMD ";
		$sql .= "  ,W75_CAMPAIGN_CD ";
		$sql .= "  ,W75_LETTERS_COUNT ";
		$sql .= "  ,W75_DEVICE_KBN ";
		$sql .= "  ,W75_TOIAWASE_KBN ";
		$sql .= "FROM ";
		$sql .= "  WEBLOG1_USER.W75LETTERS_CAMPAIGN ";

		//===条件===
		$sql .= "WHERE W75_CAMPAIGN_KBN = :campaignKbn ";
		$sql .= "  AND W75_TOIAWASE_YMD = :toiawaseYmd ";
		$sql .= "  AND W75_CAMPAIGN_CD = :campaignCd ";
		$sql .= "  AND W75_DEVICE_KBN = :deviceKbn ";
		$sql .= "  AND W75_TOIAWASE_KBN = :toiawaseKbn ";
		$sql .= "  AND W75_KENSAKU_KBN = :kensakuKbn ";

		$db_params["campaignKbn"] = $intCampaignKbn;
		$db_params["toiawaseYmd"] = $strToiawaseYmd;
		$db_params["campaignCd"]  = $intCampaignCd;
		$db_params["deviceKbn"]   = $intDeviceKbn;
		$db_params["toiawaseKbn"] = $intToiawaseKbn;
		$db_params["kensakuKbn"] = $intKensakuKbn;

		$sql .= "FOR UPDATE ";

		$result = $this->dbGetList($sql, $db_params, $db);
		return $result;
	}

	/**
	 * キャンペーン反響情報を登録する
	 *
	 * @param connection $db DBコネクション
	 * @param int $intCampaignKbn キャンペーン区分(必須)
	 * @param string $strToiawaseYmd 問合せ年月日(必須)
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intDeviceKbn デバイス区分(必須)
	 * @param int $intToiawaseKbn 問い合わせ区分(必須)
	 * @param int $intKensakuKbn 反響区分 0:物件問合せﾒｰﾙ 1:ﾘｸｴｽﾄﾒｰﾙ 2:店舗問合せﾒｰﾙ
	 *
	 * @return int 処理件数
	 */
	public function InsLettersCampaign($db, $intCampaignKbn, $strToiawaseYmd, $intCampaignCd, $intDeviceKbn, $intToiawaseKbn, $intKensakuKbn = 0)
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO WEBLOG1_USER.W75LETTERS_CAMPAIGN (";
		$sql .= "   W75_CAMPAIGN_KBN ";
		$sql .= "  ,W75_TOIAWASE_YMD ";
		$sql .= "  ,W75_CAMPAIGN_CD ";
		$sql .= "  ,W75_LETTERS_COUNT ";
		$sql .= "  ,W75_DEVICE_KBN ";
		$sql .= "  ,W75_TOIAWASE_KBN ";
		$sql .= "  ,W75_KENSAKU_KBN ";
		$sql .= ") VALUES ( ";
		$sql .= "   :campaignKbn ";
		$sql .= "  ,:toiawaseYmd ";
		$sql .= "  ,:campaignCd ";
		$sql .= "  ,1 ";
		$sql .= "  ,:intDeviceKbn ";
		$sql .= "  ,:toiawaseKbn ";
		$sql .= "  ,:kensakuKbn ";
		$sql .= ")";

		$db_params["campaignKbn"]  = $intCampaignKbn;
		$db_params["toiawaseYmd"]  = $strToiawaseYmd;
		$db_params["campaignCd"]   = $intCampaignCd;
		$db_params["intDeviceKbn"] = $intDeviceKbn;
		$db_params["toiawaseKbn"]  = $intToiawaseKbn;
		$db_params["kensakuKbn"]  = $intKensakuKbn;

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W75LETTERS_CAMPAIGN");
	}

	/**
	 * キャンペーン反響情報を更新する
	 *
	 * @param connection $db DBコネクション
	 * @param int $intCampaignKbn キャンペーン区分(必須)
	 * @param string $strToiawaseYmd 問合せ年月日(必須)
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intDeviceKbn デバイス区分(必須)
	 * @param int $intToiawaseKbn 問い合わせ区分(必須)
	 * @param int $intKensakuKbn 反響区分 0:物件問合せﾒｰﾙ 1:ﾘｸｴｽﾄﾒｰﾙ 2:店舗問合せﾒｰﾙ
	 *
	 * @return int 処理件数
	 */
	public function UpdLettersCampaign($db, $intCampaignKbn, $strToiawaseYmd, $intCampaignCd, $intDeviceKbn, $intToiawaseKbn, $intKensakuKbn = 0)
	{
		$sql = "";
		$db_params = array();

		$sql .= "UPDATE WEBLOG1_USER.W75LETTERS_CAMPAIGN SET ";
		$sql .= "   W75_LETTERS_COUNT = W75_LETTERS_COUNT + 1 ";
		//$sql .= "  ,W75_DEVICE_KBN = :intDeviceKbn ";
		$sql .= "WHERE W75_CAMPAIGN_KBN = :campaignKbn ";
		$sql .= "  AND W75_TOIAWASE_YMD = :toiawaseYmd ";
		$sql .= "  AND W75_CAMPAIGN_CD = :campaignCd ";
		$sql .= "  AND W75_DEVICE_KBN = :intDeviceKbn ";
		$sql .= "  AND W75_TOIAWASE_KBN = :toiawaseKbn ";
		$sql .= "  AND W75_KENSAKU_KBN = :kensakuKbn ";

		$db_params["campaignKbn"] = $intCampaignKbn;
		$db_params["toiawaseYmd"] = $strToiawaseYmd;
		$db_params["campaignCd"] = $intCampaignCd;
		$db_params["intDeviceKbn"] = $intDeviceKbn;
		$db_params["toiawaseKbn"]  = $intToiawaseKbn;
		$db_params["kensakuKbn"]  = $intKensakuKbn;

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W75LETTERS_CAMPAIGN");
	}

	/**
	 * キャンペーン応募情報を登録する
	 *
	 * @param connection $db DBコネクション
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intToiawaseKbn 問い合わせ区分(必須)
	 * @param int $intToiawaseId 問い合わせID(必須)
	 * @param int $intCampaignKbn キャンペーン区分(必須)
	 * @param int $intDeviceKbn デバイス区分(必須)
	 * @param array $arrBukken 物件データ（部屋付きキャンペーンのみ）
	 *
	 * @return int 処理件数
	 */
	public function InsApplyCampaign($db, $intCampaignCd, $intToiawaseKbn, $intToiawaseId, $intCampaignKbn, $intDeviceKbn, $arrBukken = array())
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO WEBLOG1_USER.W76APPLY_CAMPAIGN (";
		$sql .= "   W76_CAMPAIGN_CD ";
		$sql .= "  ,W76_TOIAWASE_KBN ";
		$sql .= "  ,W76_TOIAWASE_ID ";
		$sql .= "  ,W76_CAMPAIGN_KBN ";
		$sql .= "  ,W76_DEVICE_KBN ";
		$sql .= "  ,W76_TOIAWASE_DATE ";
		$sql .= "  ,W76_TENPO_CD ";
		$sql .= "  ,W76_ORIGINAL_HEYA_CD01 ";
		$sql .= "  ,W76_KASHIDASHI_KUBUN ";
		$sql .= ") VALUES ( ";
		$sql .= "   :campaignCd ";
		$sql .= "  ,:toiawaseKbn ";
		$sql .= "  ,:toiawaseId ";
		$sql .= "  ,:campaignKbn ";
		$sql .= "  ,:deviceKbn ";
		$sql .= "  ,sysdate ";
		$sql .= "  ,:tenpoCd ";
		$sql .= "  ,:orgHeyaCd ";
		$sql .= "  ,:kashidashiKbn ";
		$sql .= ")";

		$db_params["campaignCd"]   = $intCampaignCd;
		$db_params["toiawaseKbn"]  = $intToiawaseKbn;
		$db_params["toiawaseId"]   = $intToiawaseId;
		$db_params["campaignKbn"]  = $intCampaignKbn;
		$db_params["deviceKbn"]    = $intDeviceKbn;
		if (empty($arrBukken['tenpoCd'])) {
			$db_params["tenpoCd"]       = '00000000';
		} else {
			$db_params["tenpoCd"]       = $arrBukken['tenpoCd'];
		}
		if (empty($arrBukken['orgHeyaCd'])) {
			$db_params["orgHeyaCd"]     = '0';
		} else {
			$db_params["orgHeyaCd"]     = $arrBukken['orgHeyaCd'];
		}
		if (empty($arrBukken['orgHeyaCd'])) {
			$db_params["kashidashiKbn"] = 0;
		} else {
			$db_params["kashidashiKbn"] = $arrBukken['kashidashiKbn'];
		}

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W76APPLY_CAMPAIGN");
	}

	/**
	 * キャンペーン応募情報を登録する(枝番付き)
	 *
	 * @param connection $db DBコネクション
	 * @param int $intCampaignCd キャンペーンコード(必須)
	 * @param int $intItemCD キャンペーンアイテムCD(必須)
	 * @param int $intToiawaseKbn 問い合わせ区分(必須)
	 * @param int $intToiawaseId 問い合わせID(必須)
	 * @param int $intCampaignKbn キャンペーン区分(必須)
	 * @param int $intDeviceKbn デバイス区分(必須)
	 * @param array $arrBukken 物件データ（部屋付きキャンペーンのみ）
	 *
	 * @return int 処理件数
	 */
	public function InsApplyCampaignItem($db, $intCampaignCd, $intItemCd, $intToiawaseKbn, $intToiawaseId, $intCampaignKbn, $intDeviceKbn, $arrBukken = array())
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO WEBLOG1_USER.W76APPLY_CAMPAIGN (";
		$sql .= "   W76_CAMPAIGN_CD ";
		$sql .= "  ,W76_ITEM_CD ";
		$sql .= "  ,W76_TOIAWASE_KBN ";
		$sql .= "  ,W76_TOIAWASE_ID ";
		$sql .= "  ,W76_CAMPAIGN_KBN ";
		$sql .= "  ,W76_DEVICE_KBN ";
		$sql .= "  ,W76_TOIAWASE_DATE ";
		$sql .= "  ,W76_TENPO_CD ";
		$sql .= "  ,W76_ORIGINAL_HEYA_CD01 ";
		$sql .= "  ,W76_KASHIDASHI_KUBUN ";
		$sql .= ") VALUES ( ";
		$sql .= "   :campaignCd ";
		$sql .= "  ,:itemCd ";
		$sql .= "  ,:toiawaseKbn ";
		$sql .= "  ,:toiawaseId ";
		$sql .= "  ,:campaignKbn ";
		$sql .= "  ,:deviceKbn ";
		$sql .= "  ,sysdate ";
		$sql .= "  ,:tenpoCd ";
		$sql .= "  ,:orgHeyaCd ";
		$sql .= "  ,:kashidashiKbn ";
		$sql .= ")";

		$db_params["campaignCd"]   = $intCampaignCd;
		$db_params["itemCd"]   	   = $intItemCd;
		$db_params["toiawaseKbn"]  = $intToiawaseKbn;
		$db_params["toiawaseId"]   = $intToiawaseId;
		$db_params["campaignKbn"]  = $intCampaignKbn;
		$db_params["deviceKbn"]    = $intDeviceKbn;
		if (empty($arrBukken['tenpoCd'])) {
			$db_params["tenpoCd"]       = '00000000';
		} else {
			$db_params["tenpoCd"]       = $arrBukken['tenpoCd'];
		}
		if (empty($arrBukken['orgHeyaCd'])) {
			$db_params["orgHeyaCd"]     = '0';
		} else {
			$db_params["orgHeyaCd"]     = $arrBukken['orgHeyaCd'];
		}
		if (empty($arrBukken['orgHeyaCd'])) {
			$db_params["kashidashiKbn"] = 0;
		} else {
			$db_params["kashidashiKbn"] = $arrBukken['kashidashiKbn'];
		}

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W76APPLY_CAMPAIGN");
	}

	/**
	 * キャンペーンダウンロード管理情報を登録する。
	 *
	 * @param connection $db DBコネクション
	 * @param int $intToiawaseId 問い合わせID(必須)
	 * @param str $strAccessKey  アクセスキー(必須)
	 *
	 * @return int 処理件数
	 */
	public function InsCampaignDownload($db,$intToiawaseId, $strAccessKey)
	{
		$sql .= "INSERT INTO WEBLOG1_USER.W25CAMPAIGN_DOWNLOAD_MNG (";
		$sql .= "   W25_TOIAWASE_ID ";
		$sql .= "  ,W25_ACCESS_KEY ";
		$sql .= "  ,W25_TOUROKUBI ";
		$sql .= ") VALUES ( ";
		$sql .= "   :toiawaseId ";
		$sql .= "  ,:accessKey ";
		$sql .= "  ,SYSDATE ";
		$sql .= ")";

		$db_params["toiawaseId"]	= $intToiawaseId;
		$db_params["accessKey"]		= $strAccessKey;

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W25CAMPAIGN_DOWNLOAD_MNG");
	}

	/**
	 * キャンペーンダウンロード管理情報を登録する。(EXILE)
	 *
	 * @param connection $db DBコネクション
	 * @param int $intToiawaseId 問い合わせID(必須)
	 * @param str $mobileKbn モバイル区分(必須)
	 * @param str $strAccessKey  アクセスキー(必須)
	 *
	 * @return int 処理件数
	 */
	public function InsExileCampaignDownload($db, $intToiawaseId, $mobileKbn, $strAccessKey)
	{
		$sql  = "";
		$sql .= "INSERT INTO WEBLOG1_USER.W25CAMPAIGN_DOWNLOAD_EXILE (";
		$sql .= "   W25_TOIAWASE_ID ";
		$sql .= "  ,W25_MOBILE_KBN ";
		$sql .= "  ,W25_ACCESS_KEY ";
		$sql .= "  ,W25_TOUROKUBI ";
		$sql .= ") VALUES ( ";
		$sql .= "   :toiawaseId ";
		$sql .= "  ,:mobileKbn ";
		$sql .= "  ,:accessKey ";
		$sql .= "  ,SYSDATE ";
		$sql .= ")";

		$db_params = array();
		$db_params["toiawaseId"]	= $intToiawaseId;
		$db_params["mobileKbn"]		= $mobileKbn;
		$db_params["accessKey"]		= $strAccessKey;

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W25CAMPAIGN_DOWNLOAD_EXILE");
	}






	//============================================================================//
	//  説明
	//    ｸｴﾘ用 フラグ取得処理
	//============================================================================//
	//  引数
	//    val		- 対象値
	//============================================================================//
	//  戻り値
	//    フラグ(0,1)
	//============================================================================//
	private function ChgQryFmtToFlg($val)
	{
		$result = 0;
		if (!Apm_Otheritems::IsNullOrEmpty($val))
		{
			$result = 1;
		}
		return $result;
	}

	//============================================================================//
	//  説明
	//    ｸｴﾘ用 変数値設定処理
	//============================================================================//
	//  引数
	//    strValue		- 対象値
	//    strEncChar   	- 対象値 囲み記号
	//============================================================================//
	//  戻り値
	//    ﾌｨｰﾙﾄﾞ設定値文字列
	//============================================================================//
	private function ChgQryFmt($val, $encChar)
	{
		$result = "Null";

		if (strcmp($this->Fs_ChangeValue($val, ""), "") != 0)
		{
			//対象値が設定されていた場合
			$result = $encChar . str_replace("'", "''", $val) . $encChar;
		}
		return $result;
	}


	//=====../include/cgi/SrhCmn.inc=====
	//TODO:こいつはモデルでも使ってるので共通化するべき。というかこもんは全部
	//フィールド値変換用スクリプト
	private function Fs_ChangeValue($value, $nullValue)
	{
		$work = $value;
		if (is_null($value))
		{
			$work = $nullValue;
		}
		return $work;
	}
}
?>
